package UseIO.UseFileInOutStream;

import java.io.FileReader;
import java.io.IOException;

public class FileReaderAndWriter {
    public static void main(String[] args) throws IOException {
        useFileWriter();
    }
    public static void useFileWriter() throws IOException {
        FileReader f = new FileReader("8.内置模块/UseIO/ChangeFileContent.txt");
        int b;
        while ((b=f.read())!= -1){
            System.out.print((char) b);
        }
        f.close();
        System.out.println();
        // 一次读取多个
        FileReader f2 = new FileReader("8.内置模块/UseIO/ChangeFileContent.txt");
        char[] arr = new char[2];
        int a;
        while ((a=f2.read(arr))!=-1){
            System.out.print(new String(arr,0,a));
        }
        f2.close();
    }
}
